// 导入vant
import Vant from 'vant'
import 'vant/lib/index.css'

import Vue from 'vue'

import router from './router'

import i18n from './lang/lang' //自定义国际化语言包

export const eventBus = new Vue()


Vue.use(Vant)

import { Locale } from 'vant'

import vantlocaleen from 'vant/lib/locale/lang/en-US'

Locale.use('en', vantlocaleen)



import JsonExcel from 'vue-json-excel'
Vue.component('downloadExcel', JsonExcel)

import vueEsign from 'vue-esign'
Vue.use(vueEsign)

// 倒入 http 文件夹下的 index.js
import api from '@/http/index'

Vue.use(api)

// rem适配导入
import '@/assets/js/flexible.js'

// 路由拦截
import '@/permission.js'

// 引入通用样式
import '@/styles/base.less'

// 图片预览
import VueImageSwipe from 'vue-image-swipe'
import 'vue-image-swipe/dist/vue-image-swipe.css'
Vue.use(VueImageSwipe)

Vue.config.productionTip = false

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'





Vue.use(ElementUI)
import App from './App'
Vue.filter('dateFormat', function(originVal) {
        const dt = new Date(originVal);

        //获取年份
        const y = dt.getFullYear();
        //获取月份，月份是从0开始，需要+1，先＋1转换成字符串，调用字符串的padStart方法，保证位数为2，不足补0
        const m = (dt.getMonth() + 1 + '').padStart(2, '0');
        const d = (dt.getDate() + '').padStart(2, '0');

        const hh = (dt.getHours() + '').padStart(2, '0');
        const mm = (dt.getMinutes() + '').padStart(2, '0');
        const ss = (dt.getSeconds() + '').padStart(2, '0');

        return `${y}/${m}/${d} `;
    })
    /* eslint-disable no-new */
new Vue({
    el: '#app',
    i18n,
    router,
    components: { App },
    template: '<App/>'
})
